<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

# 后台首页
Route::group([
    'namespace'=>"Admin"
],function(\Illuminate\Routing\Router $router) {
    Route::group([
        'middleware' => ['adminLoginAuth'] # 验证用户登录
    ], function (\Illuminate\Routing\Router $router) {
        # 后台主页
        $router->get('/', 'HomeController@homePage')->name('admin.homepage.index');
        $router->get('homePage', function () {
            $url = route('admin.homepage.index');
            return redirect($url);
        })->name('homePage');
        /*
         |****************************
         | Admins
         | 管理员
         |****************************
         */
        Route::group([
            'namespace'=>'Admins',
            'prefix'=>'admins'
        ],function(\Illuminate\Routing\Router $router){
            # 列表
            $router->any('index', 'AdminsController@index')->name('admin.index');
            # 添加
            $router->any('add', 'AdminsController@add')->name('admin.add');
            # 编辑
            $router->any('edit/{id?}', 'AdminsController@edit')->name('admin.edit');
            # 操作日志
            $router->any('log', 'AdminsController@log')->name('admin.operate.log');
        });
    });
});
